package com.atguigu.gmall.product.client;

import com.atguigu.gmall.model.product.BaseCategoryView;
import com.atguigu.gmall.model.product.SkuInfo;
import com.atguigu.gmall.model.product.SpuSaleAttr;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * description:
 * create by sxy 2021/5/13
 */
@FeignClient(name = "service-product",fallback = DegradedProductFeignClient.class)
public interface ProductFeignClient {

    //1、skuInfo  库存信息 SkuInfo图片  /inner 字样表示是内部资源 不允许外来的请求访问  网关全局过滤器
    @GetMapping("/api/product/inner/getSkuInfo/{skuId}")
    public SkuInfo getSkuInfo(@PathVariable Long skuId);
    //2、一二三级分类
    @GetMapping("/api/product/inner/getBaseCategoryView/{category3Id}")
    public BaseCategoryView getBaseCategoryView(@PathVariable Long category3Id);

    //3、销售属性及值及选中红边框
    @GetMapping("/api/product/inner/getSpuSaleAttrValueChecked/{skuId}/{spuId}")
    public List<SpuSaleAttr> getSpuSaleAttrValueChecked(@PathVariable Long skuId,
                                                        @PathVariable Long spuId);
    //4、销售属性值组合对应库存ID    入参：商品ID spuId
    @GetMapping("/api/product/inner/getValuesSkuJson/{spuId}")
    public Map getValuesSkuJson(@PathVariable Long spuId);

    //5 单独查询价格，目的是不放在缓存中
    @GetMapping("/api/product/inner/getPrice/{skuId}")
    public BigDecimal getPrice(@PathVariable Long skuId);
}

